package dyyx.demo;
import java.util.Date;

import org.apache.hadoop.fs.Path;
import org.apache.parquet.example.data.Group;
import org.apache.parquet.hadoop.ParquetReader;
import org.apache.parquet.hadoop.example.GroupReadSupport;
import org.apache.parquet.hadoop.ParquetReader.Builder;


import dyyx.util.CommUtil;

public class ReaderTest {

	public static void main(String[] args) throws Exception {
		System.out.println("hello,ReaderTest,"+new Date());
		
		System.out.println(CommUtil.getUserHome());
		
		String file = CommUtil.getUserHome() +"/tmp/parquet.data";

		GroupReadSupport readSupport = new GroupReadSupport();
        Builder<Group> reader= ParquetReader.builder(readSupport, new Path(file));
        ParquetReader<Group> build=reader.build();
        Group group=null;
        while((group=build.read())!=null){       	
        	 System.out.println(group.getInteger("id", 0)+","+group.getString("name", 0));
        }

		


	}
}
